#include <iostream>
#include <string>
#include <memory>
//装饰模式


class Finery
{
public:
    using ptr=std::shared_ptr<Finery>;
    virtual void show()=0;
    virtual ~Finery() {};
};

class ConcrateFinery:public Finery
{
public:
    using ptr=std::shared_ptr<ConcrateFinery>;
    virtual void show() override
    {
        std::cout<<"hello"<<std::endl;
    }
    virtual ~ConcrateFinery() {};
};

class Person:public Finery
{
public:
    using ptr=std::shared_ptr<Person>;
    Person(std::string name):m_name(name)
    {}
    virtual void show() override
    {
        std::cout<<"装扮的"<<this->m_name<<std::endl;
    }
private:
    std::string m_name;
};

class TShirts:public Finery
{
public:
    using ptr=std::shared_ptr<TShirts>;

    TShirts(Finery::ptr f)
    {
        m_component=f;
    }
    ~TShirts() override{}
    void show() override
    {
        m_component->show();
        std::cout<<"穿T恤"<<std::endl;
    }
private:
    Finery::ptr m_component;
};

class Suits:public Finery
{
public:
    using ptr=std::shared_ptr<Suits>;

    Suits(Finery::ptr f)
    {
        m_component=f;
    }
    ~Suits(){}
    void show() override
    {
        m_component->show();
        std::cout<<"穿西服"<<std::endl;
    }
private:
    Finery::ptr m_component;
};

int main(int argc, char** argv)
{
    Person::ptr person(new Person("Daniel"));
    TShirts::ptr shirt(new TShirts(person));
    Suits::ptr suit(new Suits(shirt));
    suit->show();
    return 0;
}